﻿@inherits EditOperationDialogBase<FunctionDto, Guid>

<Form Loading="@_dialogLoading.Value"
      Model="@_editModel"
      LabelCol="new ColLayoutParam { Span = 8 }"
      WrapperCol="new ColLayoutParam { Span = 16 }"
      OnFinish="OnFormFinish"
      Context="model">
    <FormItem Label="编号">
        <Input @bind-Value="@model.Id" Disabled />
    </FormItem>
    <FormItem Label="分组">
        <Input @bind-Value="@model.Group" />
    </FormItem>
    <FormItem Label="服务">
        <Input @bind-Value="@model.Service" />
    </FormItem>
    <FormItem Label="概要">
        <Input @bind-Value="@model.Summary" />
    </FormItem>
    <FormItem Label="地址">
        <Input @bind-Value="@model.Path" />
    </FormItem>
    <FormItem Label="请求方法">
        <SimpleSelect @bind-Value="@_currentEditModelHttpMethodType"
                      DefaultValue="@(model.Method.ToString())"
                      Style="width:120px;">
            <SelectOptions>
                @foreach (var gitem in EnumHelper.EnumToDictionary<HttpMethod>())
                {
                    <SimpleSelectOption Value="@(gitem.Key.ToString())" Label="@(gitem.Value)"></SimpleSelectOption>
                }
            </SelectOptions>
        </SimpleSelect>
    </FormItem>
    <FormItem Label="描述">
        <TextArea AutoSize="true" MinRows="2" MaxRows="6" @bind-Value="@model.Description"></TextArea>
    </FormItem>
    <FormItem Label="启用审计">
        <Switch @bind-Value="@model.EnableAudit"></Switch>
    </FormItem>
    <FormItem Label="@Localizer[SharedLocalResource.IsLocked]">
        <Switch @bind-Value="@model.IsLocked"></Switch>
    </FormItem>

    @if (this.Options.Type.Equals(DrawerInputType.Edit) || this.Options.Type.Equals(DrawerInputType.Select))
    {
        <FormItem Label="@Localizer[SharedLocalResource.CreatedTime]">
            <span>@model.CreatedTime.ToString(ClientConstant.DateTimeFormat)</span>
        </FormItem>
        <FormItem  Label="@Localizer[SharedLocalResource.UpdatedTime]">
            <span>@model.UpdatedTime?.ToString(ClientConstant.DateTimeFormat)</span>
        </FormItem>
    }
    <FormItem WrapperColOffset="8" WrapperColSpan="16">
        <Space>
            @if (!DrawerInputType.Select.Equals(this.Options.Type))
            {
                <SpaceItem>
                    <Button Type="@ButtonType.Primary" HtmlType="submit">
                        @Localizer[SharedLocalResource.Save]
                    </Button>
                </SpaceItem>
            }
            <SpaceItem>
                <Button OnClick="_=>OnFormCancel()">
                    @Localizer[SharedLocalResource.Cancel]
                </Button>
            </SpaceItem>
        </Space>
    </FormItem>
</Form>